package com.item.service.impl;

import com.github.pagehelper.PageHelper;
import com.item.domain.Chapter;
import com.item.mapper.ChapterPayMapper;
import com.item.service.ChapterPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ChapterPayServiceImpl implements ChapterPayService {

    @Autowired
    ChapterPayMapper chapterPayMapper;


    public List<Chapter> findAll(int limit, int page, Chapter chapter) {
        if (limit > 0 && page > 0) {
            PageHelper.startPage(limit, page);
        }
        return chapterPayMapper.findAll(chapter);
    }


    public int add(Chapter chapter) {
        return chapterPayMapper.insertSelective(chapter);
    }


    public int update(Chapter chapter) {
        return chapterPayMapper.updateByPrimaryKey(chapter);
    }

    @Override
    public int delete(int id) {
        return chapterPayMapper.deleteByPrimaryKey(id);
    }
}
